hal_Osram_SFH5711_ambient_light_sensor.c File Reference

Conversion routines for the Osram SFH5711 Ambient Light Sensor. More...

#include <math.h>



#define LIGHT_SENSOR_USE_LOOKUP_TABLE
unsigned int convertAdcToLux (unsigned int adc)

Detailed Description

Conversion routines for the Osram SFH5711 Ambient Light Sensor.

Note:
Light sensor outputs current between 0 to 50uA. On the target board, load resistor = 47k Ohms.
0 to 100,000lx will generate 0 to 2350mV input into an Analog to Digital Converter (ADC).
This particular light sensor is binned for a sensitivity of 27 to 30 uA @ 1000lux = 1269-1410 mV = ADC readings of 520-578counts
there are two versions of the convertAdcToLux() method:
  • Use a lookup table. Faster and less code, but also less accurate.
  • Compute the value directly based on equation supplied by the manufacturer. This is much more accurate but requires approximately 4.2kB more code for the pow() function in math.h.
Rev
545
Author
dsmith
Date
2010-05-27 17:09:05 -0700 (Thu, 27 May 2010)

YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.


Function Documentation

unsigned int convertAdcToLux ( unsigned int  adc  ) 

Converts the raw ADC value to lux for the Osram SFH 5711 light sensor using pow() method in math.h. Conversion:

  • Convert ADC to millivolts: mV=(ADC/1024) * 2500 (10bit ADC = 1024counts; we're using the 2.5V reference)
  • Convert millivolts to microAmps: uA = mV / 47 (since the design uses a 47kOhm load resistor)
  • Convert microAmps to lux: lux = 10^(uA/10)
    Parameters:
    adc the raw reading from the Analog to Digital converter
    Returns:
    the amount of light, in lux/10.
 All Files Functions Variables
Generated on Thu Aug 19 11:48:31 2010 for Hardware Abstraction Layer by  doxygen 1.6.3